package com.yoomiito.app.ui.my;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.yoomiito.app.R;
import com.yoomiito.app.base.App;
import com.yoomiito.app.base.BaseActivity;
import com.yoomiito.app.model.bean.BankBean;
import com.yoomiito.app.model.bean.SaleBean;
import com.yoomiito.app.present.my.activity.MySalePresenter;
import com.yoomiito.app.present.my.activity.RealNamePresenter;
import com.yoomiito.app.utils.AllUtils;
import com.yoomiito.app.utils.CheckUtil;
import com.yoomiito.app.widget.ItemView;

import butterknife.BindView;
import butterknife.OnClick;
import chihane.jdaddressselector.BottomDialog;

public class MySaleActivity extends BaseActivity<MySalePresenter> {


    @BindView(R.id.tv_team)
    TextView tvTeam;
    @BindView(R.id.tv_team_value)
    TextView tvTeamValue;
    @BindView(R.id.tv_bond)
    TextView tvBond;
    @BindView(R.id.tv_bond_msg)
    TextView tvBondMsg;
    @BindView(R.id.tv_own)
    TextView tvOwn;

    private String date;


    @Override
    public int getLayoutId() {
        return R.layout.activity_my_sale;
    }

    @Override
    public MySalePresenter newP() {
        return new MySalePresenter(App.mAppConfig);
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        super.initData(savedInstanceState);
        getP().getAchieve();
    }


    public void setData(SaleBean data) {

        if (data != null) {
            tvTeam.setText(data.month + " 团队业绩");
            tvTeamValue.setText(data.team);
            tvBondMsg.setText(data.bondMsg);
            tvBond.setText(data.bond);
            tvOwn.setText(data.own);
            date = data.month;
            if (data.bondShow == 0) {
                findViewById(R.id.ll_bond).setVisibility(View.GONE);
            }
        }
    }


    @OnClick({R.id.tv_more, R.id.tv_more2})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tv_more:
                startActivity(new Intent(this, MyTeamSaleActivity.class)
                        .putExtra("date", date)
                );
                break;
            case R.id.tv_more2:
                startActivity(new Intent(this, MyBondDetailActivity.class)
                        .putExtra("date", date)
                );
                break;

        }

    }
}
